home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 146
/
(Vol 146) Jan 07 2012.iso
/
Games
/
scuba.swf
/
scripts
/
frame_18
/
PlaceObject2_130_181
/
CLIPACTIONRECORD onClipEvent(enterFrame).as
next >
Wrap
Text File
|
2012-01-07
|
5KB
|
110 lines
onClipEvent(enterFrame){
if(status == "active")
{
if(this._x >= _root.RIGHT_BOUND)
{
if(_root.coral.hitTest(Number(this._x - Number(_root.FISH_ACCEL)),this._y,true) == true)
{
vSideOfImpact = "undetermined";
vPixelCounter = Number(1);
while(vSideOfImpact == "undetermined")
{
if(_root.coral.hitTest(Number(this._x - Number(_root.FISH_ACCEL)),Number(this._y + Number(vPixelCounter)),true) == false && Number(this._y + Number(vPixelCounter)) < _root.BOTTOM_BOUND)
{
vSideOfImpact = "top";
vPixelOffset = vPixelCounter;
}
else if(_root.coral.hitTest(Number(this._x - Number(_root.FISH_ACCEL)),Number(this._y - Number(vPixelCounter)),true) == false && _root.TOP_BOUND < Number(this._y - Number(vPixelCounter)))
{
vSideOfImpact = "bottom";
vPixelOffset = vPixelCounter;
}
vPixelCounter++;
}
if(vSideOfImpact == "top")
{
setProperty(this, _Y, Number(this._y + Number(vPixelOffset)));
}
else if(vSideOfImpact == "bottom")
{
setProperty(this, _Y, Number(this._y - Number(vPixelOffset)));
}
}
}
else if(this._x < _root.RIGHT_BOUND)
{
vSideOfImpact = "undetermined";
i = 5;
while(i < 100 && vSideOfImpact == "undetermined")
{
if(_root.coral.hitTest(Number(this._x - Number(_root.FISH_ACCEL) * i),this._y,true) == true)
{
vPixelCounter = Number(1);
while(vSideOfImpact == "undetermined")
{
vAdjustmentDiv = Number(i);
if(_root.coral.hitTest(Number(this._x - Number(_root.FISH_ACCEL) * i),Number(this._y - Number(vPixelCounter)),true) == true && _root.coral.hitTest(Number(this._x - Number(_root.FISH_ACCEL) * i),Number(this._y + Number(vPixelCounter)),true) == false)
{
vSideOfImpact = "top";
vPixelOffset = Number(vPixelCounter + Number(this._height * 2));
}
else if(_root.coral.hitTest(Number(this._x - Number(_root.FISH_ACCEL) * i),Number(this._y - Number(vPixelCounter)),true) == false && _root.coral.hitTest(Number(this._x - Number(_root.FISH_ACCEL) * i),Number(this._y + Number(vPixelCounter)),true) == true)
{
vSideOfImpact = "bottom";
vPixelOffset = Number(vPixelCounter + Number(this._height * 2));
}
vPixelCounter++;
}
if(vSideOfImpact == "top")
{
if(vSwimmingDir == "straight")
{
vSwimmingDir = "down";
setProperty(this, _Y, this._y + Number(vPixelOffset / vAdjustmentDiv));
}
else if(vSwimmingDir == "down")
{
setProperty(this, _Y, this._y + Number(vPixelOffset / vAdjustmentDiv));
}
else if(vSwimmingDir == "up")
{
vSwimmingDir = "straight";
}
}
else if(vSideOfImpact == "bottom")
{
if(vSwimmingDir == "straight")
{
vSwimmingDir = "up";
setProperty(this, _Y, this._y - Number(vPixelOffset / vAdjustmentDiv));
}
else if(vSwimmingDir == "up")
{
setProperty(this, _Y, this._y - Number(vPixelOffset / vAdjustmentDiv));
}
else if(vSwimmingDir == "down")
{
vSwimmingDir = "straight";
}
}
}
else
{
vSwimmingDir = "straight";
}
i = Number(i + Number(3));
}
if(vProdded == false && _root.gProdStatus == "activated" && _root.recruit.prod.hitTest(this) == true && this._visible == 1)
{
vProdded = true;
this.gotoAndPlay("prodded");
}
else if(vAttackedDiver == false && _root.gProdStatus == "not_activated" && _root.recruit.diver.hitTest(this.hitarea) == true && vProdded == false)
{
vAttackedDiver = true;
_root.fnCreatureAttack();
}
}
}
}